//
//  MZYInfoDetailViewController.m
//  WristWatch
//
//  Created by dllo on 15/10/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "MZYInfoDetailViewController.h"
#import "UMSocial.h"

@interface MZYInfoDetailViewController ()<UMSocialUIDelegate>

@end

@implementation MZYInfoDetailViewController
- (void)dealloc {
    [_url release];
    
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIWebView *web = [[UIWebView alloc] initWithFrame:self.view.frame];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.url]];
    [self.view addSubview:web];
    [web loadRequest:request];
    [web release];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"share"] style:UIBarButtonItemStylePlain target:self action:@selector(saveStyle:)];
    
}

- (void)saveStyle:(UIBarButtonItem *)button {
    [UMSocialSnsService presentSnsIconSheetView:self
                                         appKey:@"563ac022e0f55a5cc9000192"
                                      shareText:self.url
                                     shareImage:[UIImage imageNamed:@"icon.png"]
                                shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatSession,UMShareToQQ,UMShareToRenren,UMShareToTencent,UMShareToWechatTimeline,UMShareToDouban,UMShareToWechatFavorite,nil]
                                       delegate:self];
    
}

//实现回调方法（可选）：
-(void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response
{
    //根据`responseCode`得到发送结果,如果分享成功
    if(response.responseCode == UMSResponseCodeSuccess)
    {
        //得到分享到的微博平台名
        NSLog(@"share to sns name is %@",[[response.data allKeys] objectAtIndex:0]);
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
